package com.lagou.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lagou.dao.OrdersMapper;
import com.lagou.pojo.Orders;
import com.lagou.pojo.OrdersVo;
import com.lagou.pojo.Products;
import com.lagou.pojo.ProductsVo;
import com.lagou.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author : liuchangling
 * @Descrition :
 * @Date： Created in 11:04 上午 2021/9/17
 */
@Service
public class OrderServiceImp implements OrderService {
    @Autowired
    private OrdersMapper ordersMapper;

    @Override
    public Orders findOrderById(int id) {
        return ordersMapper.selectById(id);
    }

    @Override
    public Map<String, Object> selectPage(OrdersVo ordersVo) {
        Map<String, Object> map = new HashMap<>();
        Page<Orders> page = new Page<>(ordersVo.getNum(), 10);
        QueryWrapper queryWrapper = new QueryWrapper<OrdersVo>();
        Page page1 = ordersMapper.selectPage(page, queryWrapper);
        map.put("list", page1.getRecords());
        map.put("total", page1.getTotal());
        return map;
    }
}
